package com.hdu.util;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class ReflectionUtils {

    public static List<Method> getMethodsByTargetAnnotation(Class<? extends Annotation> targetAnnotation,
                                                            Class<?> targetClass) {
        return Arrays.stream(targetClass.getDeclaredMethods())
                .filter(method -> method.isAnnotationPresent(targetAnnotation))
                .collect(Collectors.toList());
    }
}
